package fr.fort.lycee.spring.entities;

// Generated 20 mars 2015 07:40:35 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Professeur generated by hbm2java
 */
@Entity
@Table(name = "professeur", catalog = "lycee")
public class Professeur implements java.io.Serializable {

	private Integer idCompte;
	private Compte compte;
	private String nom;
	private String prenom;
	private String mail;
	private Date naissance;
	private Set<Enseignement> enseignements = new HashSet<Enseignement>(0);
	private Set<Classe> classes = new HashSet<Classe>(0);

	public Professeur() {
	}

	public Professeur(Compte compte, String nom) {
		this.compte = compte;
		this.nom = nom;
	}

	public Professeur(Compte compte, String nom, String prenom, String mail,
			Date naissance, Set<Enseignement> enseignements, Set<Classe> classes) {
		this.compte = compte;
		this.nom = nom;
		this.prenom = prenom;
		this.mail = mail;
		this.naissance = naissance;
		this.enseignements = enseignements;
		this.classes = classes;
	}

	@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "compte"))
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "idCompte", unique = true, nullable = false)
	public Integer getIdCompte() {
		return this.idCompte;
	}

	public void setIdCompte(Integer idCompte) {
		this.idCompte = idCompte;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public Compte getCompte() {
		return this.compte;
	}

	public void setCompte(Compte compte) {
		this.compte = compte;
	}

	@Column(name = "nom", nullable = false, length = 254)
	public String getNom() {
		return this.nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	@Column(name = "prenom", length = 254)
	public String getPrenom() {
		return this.prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	@Column(name = "mail", length = 254)
	public String getMail() {
		return this.mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "naissance", length = 19)
	public Date getNaissance() {
		return this.naissance;
	}

	public void setNaissance(Date naissance) {
		this.naissance = naissance;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "professeur")
	public Set<Enseignement> getEnseignements() {
		return this.enseignements;
	}

	public void setEnseignements(Set<Enseignement> enseignements) {
		this.enseignements = enseignements;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "professeurs")
	public Set<Classe> getClasses() {
		return this.classes;
	}

	public void setClasses(Set<Classe> classes) {
		this.classes = classes;
	}

}
